import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/login/login'
import Home from '@/views/home/home'
// import List from '@/views/list/list'
//  const List = () => import('@/views/list/list.vue')

Vue.use(Router)

export default new Router({
  routes: [{
      path: '/login',
      name: 'login',
      component: Login,

    },
    {
      path: '/home',
      name: 'home',
      component: Home
    },
    {
      path: '/list',
      name: 'list',
      meta: {
        requiresAuth: true
      },
      // component: List,

      component: () => import('@/views/list/list.vue'),
      beforeRouteEnter(to, from, next) {
        next(vm => {
          console.log(vm)
        })


        // 在渲染该组件的对应路由被 confirm 前调用
        // 不！能！获取组件实例 `this`
        // 因为当守卫执行前，组件实例还没被创建
      }

    }
  ]
})
